package com.example.design.dahua.strategy.new2simplefactorycash;

/**
 * @author ebnew
 * 返利收费类
 */
public class CashReturn extends AbstractCash {

    private double condition;
    private double moneyReturn;

    /**
     * 构造函数初始化，比如满300减200
     *
     * @param condition   条件
     * @param moneyReturn 返现金额
     */
    public CashReturn(double condition, double moneyReturn) {
        this.condition = condition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        if (money >= condition) {
            money = money - moneyReturn;
        }
        return money;
    }
}
